{% extends "tj3/tj3.html" %}


{% block content  %} 
{% load mptt_tags %}

<div id="status_report">
<h1>Status Report &mdash; {{project.name}}</h1>
<h2>Project Time</h2>
<div class="padding_left_20px">
	This project was given a schedule of {{project.start|date:"M-j-Y"}} to {{project.end|date:"M-j-Y"}}.
</div>

<h2>Project Description</h2>
<div class="padding_left_20px">
	{{project.description}}
</div>

<h2>Tasks</h2>
<div class="padding_left_20px">
	This project has {{non_leaf_count}} container tasks and {{leaf_count}} terminal tasks.
</div>
	
<h2>Task Assignments</h2>
<div class="padding_left_20px">
<table class="hor-minimalist-a">
<thead>
	<tr><th>ID
		<th>WBS
		<th>Name
		<th>Start
		<th>End
		<th>Excluding Weekends
		<th>Including Weekends
		<th>Effort
		<th>Max Start
		<th>Min Start
		<th>Max End
		<th>Min End
		<th>Dependencies
		<th>Resources
</thead>
<tbody>
{% for wbs,task,start,end,length,duration,effort,max_start,min_start,max_end,min_end,milestone,deps,ars in assignments %}
	<tr>
		<td>{{task.id}}</td>
		<td>{{wbs}}</td>
		<td class="task_name"><a href="{% url task_detail task.id %}">{{task.name}}</a></td>
		<td>{{start}}</td>
		<td>{{end}}</td>
		<td>{{length}}</td>
		<td>{{duration}}</td>
		<td>{{effort}}</td>
		<td>{{max_start}}</td>
		<td>{{min_start}}</td>
		<td>{{max_end}}</td>
		<td>{{min_end}}</td>
		<td>
		{% for d in deps %}
		{{d.to_task.id}} {{d.type}} {{d.on_what}} of {{d.from_task.id}} ({{d.gap_length}}/{{d.gap_duration}})
		{% endfor %}
		</td>
		<td>
		{% for a in ars %}
		{{a.primary.first_name}} {{a.primary.last_name}}<br />
		{% endfor %}
		</td>
	</tr>
{% endfor %}
</tbody>
</table>
</div>

<h2>Project Budget</h2>
<div class="padding_left_20px">
	<table class="zebra">
		<thead>
			<tr><td>Category
				<td>{{s1.name|capfirst}}
				<td>{{s2.name|capfirst}}
			</tr>
		</thead>
		<tbody>
		<tr>
			<td>Budget
			<td>{{s1_budget.budget}}
			<td>{{s2_budget.budget}}
		</tr>
		<tr>
			<td>Management Reserve
			<td>{{s1_budget.reserve}}
			<td>{{s2_budget.reserve}}
		</tr>
	</tbody>
	</table>
</div>

<h2>Resource Load</h2>
<div class="padding_left_20px">
	<table class="zebra">
		<thead>
			<tr>
				<td>Resource
				<td>{{s1.name|capfirst}}<br>(in Hours)
				<td>{{s2.name|capfirst}}<br>(in Hours)
			</tr>
		</thead>
		<tbody>
			{% for r, load_s1,load_s2 in loads %}
			<tr>
				<td>{{r.first_name|capfirst}} {{r.last_name|capfirst}}
				<td>{{load_s1}}
				<td>{{load_s2}}
			</tr>
			{% endfor %}
		</tbody>
	</table>
</div>

<h2>Project Task Status</h2>
<div class="padding_left_20px">
<table>
	<thead>
	<tr>
		<td rowspan="2">WBS
		<td rowspan="2">TASK
		<td rowspan="2">SCENARIO
		<td colspan="6">Scenario: {{s1.name|capfirst}} vs. {{s2.name|capfirst}}
		<td colspan="6" class="calculated">VARIANCE ({{s2.name|capfirst}} &mdash; {{s1.name|capfirst}})
	</tr>
	<tr>
		<td>COMPLETION<br>(0-100)
		<td>START
		<td>END
		<td>DURATION<br>(in Days)
		<td>EFFORT<br>(in Days)
		<td>RESOURCES
		<td>LATE START BY
		<td>LATE END BY
		<td class="calculated">DURATION
		<td class="calculated">AS % of {{s1.name|capfirst}}
		<td class="calculated">EFFORT
		<td class="calculated">AS % of {{s1.name|capfirst}}
	</tr>
	</thead>
	
	<tbody>
	{% for wbs,t,ts_1,ld_1,ts_2,ld_2,var_duration,var_effort,var_duration_pcnt,var_effort_pcnt,late_start,late_end in data %}
		<tr id="scenario_1">
			<td rowspan="2">{{wbs}}
			<td rowspan="2" class="task_name">
			<a href="{% url task_detail t.id %}">{{t.name}}</a>
			<td>{{ts_1.scenario.name|capfirst}}
			<td>{{ts_1.completion}}
			<td class="date">{{ts_1.start|date:"M-j-Y"}}
			<td class="date">{{ts_1.end|date:"M-j-Y"}}
			<td class="center">{{ts_1.duration}}
			<td class="center">{{ts_1.effort}}
			<td>
			<div>
			<table class="zebra">
			{% for l in ld_1 %}
			<tr>
				<td class="date">{{l.when|date:"M-j-Y"}}
				<td>{{l.resource.first_name|capfirst}} 
					{{l.resource.last_name|capfirst}}
				<td>{{l.load}}
			</tr>
			{% endfor %}
			</table>
			</div>
			</td>
			<td class="calculated"></td>
			<td class="calculated"></td>
			<td class="calculated"></td>
			<td class="calculated"></td>
			<td class="calculated"></td>
			<td class="calculated"></td>
		</tr>
		<tr id="scenario_2">
			<td>{{ts_2.scenario.name|capfirst}}
			<td>{{ts_2.completion}}
			<td class="date">{{ts_2.start|date:"M-j-Y"}}
			<td class="date">{{ts_2.end|date:"M-j-Y"}}
			<td class="center">{{ts_2.duration}}
			<td class="center">{{ts_2.effort}}
			<td>
			<div>
			<table class="zebra">
			{% for l in ld_2 %}
			<tr>
				<td class="date">{{l.when|date:"M-j-Y"}}
				<td>{{l.resource.first_name|capfirst}} 
					{{l.resource.last_name|capfirst}}
				<td>{{l.load}}
			</tr>
			{% endfor %}
			</table>
			</div>
			</td>
			
			<td class="calculated">{{late_start}}
			<td class="calculated">{{late_end}}
			
			{% if var_duration > 0 %}
				<td class="variance_positive calculated">
					<a href="{% url task_status_compare project.id,s1.id,s2.id,t.id,1,"duration" %}">
					{{var_duration}}</a>
				<td class="variance_positive calculated">
					<a href="{% url task_status_compare project.id,s1.id,s2.id,t.id,1,"duration" %}">
					{{var_duration_pcnt}}%</a>
			{% else %}
				<td class="variance_negative calculated">
					<a href="{% url task_status_compare project.id,s1.id,s2.id,t.id,1,"duration" %}">
					{{var_duration}}</a>
				<td class="variance_negative calculated">
					<a href="{% url task_status_compare project.id,s1.id,s2.id,t.id,1,"duration" %}">
					{{var_duration_pcnt}}%</a>
			{% endif %}
			
			{% if var_effort > 0 %}
				<td class="variance_positive calculated">
					<a href="{% url task_status_compare project.id,s1.id,s2.id,t.id,1,"effort" %}">
					{{var_effort}}</a>
				<td class="variance_positive calculated">
					<a href="{% url task_status_compare project.id,s1.id,s2.id,t.id,1,"effort" %}">
					{{var_effort_pcnt}}%</a>
			{% else %}
				<td class="variance_negative calculated">			
					<a href="{% url task_status_compare project.id,s1.id,s2.id,t.id,1,"effort" %}">
					{{var_effort}}</a>
				<td class="variance_negative calculated">			
					<a href="{% url task_status_compare project.id,s1.id,s2.id,t.id,1,"effort" %}">
					{{var_effort_pcnt}}%</a>
			{% endif %}			
		</tr>
		
		
	{% endfor %}
	</tbody>
</table>
</div>
</div>


<div>
	<h1 class="ui-state-highlight ui-corner-all">Go To</h1>
	<ul>
		<li><a href="{% url project_main_plan project.id %}">Project Planning</a>
		<li><a href="{% url project_main_actual project.id,s2.id %}">Project Actual</a>
	</ul>
</div>

{% endblock content %}
